﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using ZoneLine.Common;
using ZoneLine.Models;

namespace Common
{
    public class Cache
    {
        /// <summary>
        /// 软件运行中
        /// </summary>
        public static bool IsRunning { get; set; }
        //private static ComSingle _single = new ComSingle();

        //public static ComSingle Signal
        //{
        //    get { return _single; }
        //    set { _single = value; OnChanged(); }
        //}
        private static WorkDirectionEnum _workDirection;

        public static WorkDirectionEnum WorkDirection
        {
            get { return _workDirection; }
            set { _workDirection = value; OnChanged(); }
        }

        private static List<string> _workStationValidates = new List<string>();

        public static List<string> WorkStationValidationList { get { return _workStationValidates; } set { _workStationValidates = value; OnChanged(); } }

        private static ModelEnum _model;
        /// <summary>
        /// 工件型号
        /// </summary>
        public static ModelEnum Model
        {
            get { return _model; }
            set { _model = value; OnChanged(); }
        }

        private static bool _isHOpStation;
        /// <summary>
        /// 后减
        /// </summary>
        public static bool IsHopStaion
        {
            get { return _isHOpStation; }
            set { _isHOpStation = value; OnChanged(); }
        }

        private static bool _isQOpStation;
        /// <summary>
        /// 前减
        /// </summary>
        public static bool IsQopStaion
        {
            get { return _isQOpStation; }
            set { _isQOpStation = value; OnChanged(); }
        }

        private static bool _isXWOpStation;

        public static bool IsXWopStaion
        {
            get { return _isXWOpStation; }
            set { _isXWOpStation = value; OnChanged(); }
        }

        /// <summary>
        /// 进入工件替换模式
        /// </summary>
        public static bool EnterReplaceStatus { get; set; }

        #region 静态观察者

        public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;

        private static void OnChanged([CallerMemberName] string str = "")
        {
            StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(str));
        }
        #endregion

    }
}
